{template '_header'}

<div class="page-header">
    当前位置：<span class="text-primary">{if !empty($item['id'])}编辑{else}添加{/if}店员{if !empty($item['id'])}({$item['salername']}){/if}</span>
</div>

<div class="page-content">
    {ifp 'shop.verify.saler.add'}
    <div class="page-sub-toolbar">
         <span class=''>
            <a class="btn btn-primary btn-sm" href="{php echo webUrl('shop/verify/saler/add')}">添加新店员</a>
        </span>
        {/if}
    </div>
    <form {ife 'shop.verify.saler' $item}action="" method="post"{/if} class="form-horizontal form-validate" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$item['id']}" />
        <div class="form-group">
            <label class="col-lg control-label must">选择会员</label>
            <div class="col-sm-9 col-xs-12">
                {ife 'shop.verify.saler' $item}
                    {php echo tpl_selector('openid',array('key'=>'openid', 'required'=>true, 'text'=>'nickname', 'thumb'=>'avatar','placeholder'=>'昵称/姓名/手机号','buttontext'=>'选择会员 ', 'items'=>$saler,'url'=>webUrl('member/query') ))}
                {else}
                    {if !empty($saler)}
                        <span class='help-block'>
                            <img  style="width:100px;height:100px;border:1px solid #ccc;padding:1px" src="{php echo tomedia($saler['avatar'])}"/><br/>{if !empty($saler)}{$saler['nickname']}/{$saler['realname']}/{$saler['mobile']}{/if}
                        </span>
                    {/if}
                {/if}
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label must">店员姓名</label>
            <div class="col-sm-9 col-xs-12">
                {ife 'shop.verify.saler' $item}
                    <input type="text" name="salername" class="form-control" value="{$item['salername']}" data-rule-required='true'/>
                {else}
                    <div class='form-control-static'>{$item['salername']}</div>
                {/if}
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">所属门店</label>
            <div class="col-sm-9 col-xs-12">
                {ife 'shop.verify.saler' $item}
                    {php echo tpl_selector('storeid',array('text'=>'storename','preview'=>true,'type'=>'text',  'thumb'=>'avatar','placeholder'=>'门店名称','buttontext'=>'选择门店 ', 'items'=>$store,'url'=>webUrl('shop/verify/store/query')))}
                    <span class='help-block'>如果不选择门店，则可以进行全门店的核销</span>
                {else}
                    <div class='form-control-static'>{if empty($store['storename'])}全店核销{else}{$store['storename']}{/if}</div>
                {/if}
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">状态</label>
            <div class="col-sm-9 col-xs-12">
                {ife 'shop.verify.saler' $item}
                    <label class='radio-inline'><input type='radio' name='status' value=1' {if $item['status']==1}checked{/if} /> 启用</label>
                    <label class='radio-inline'><input type='radio' name='status' value=0' {if $item['status']==0}checked{/if} /> 禁用</label>
                {else}
                    <div class='form-control-static'>{if $item['status']==1}启用{else}禁用{/if}</div>
                {/if}
            </div>
        </div>
        <div class="form-group"></div>
        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                {ife 'shop.verify.saler' $item}
                    <input type="submit" value="提交" class="btn btn-primary"  />
                {/if}
                <input type="button" name="back" onclick='history.back()' {ifp 'shop.verify.saler.add|shop.verify.saler.edit'}style='margin-left:10px;'{/if} value="返回列表" class="btn btn-default" />
            </div>
        </div>
    </form>
</div>

{template '_footer'}